<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title th:text="${sectionName}">STAR社区</title>
    <link rel="stylesheet" href="/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="/bootstrap/css/bootstrap-theme.min.css">
    <link rel="stylesheet" href="/css/index.css">
</head>
<body>
<nav th:replace="_fragment :: nav"></nav>
<div class="container-fluid main" >
    <div class="row">
        <div class="col-lg-9 col-md-12  col-sm-12  col-xs-12" >
            <h2 th:text="${sectionName}"></h2>
            <hr>
            <div th:if="${result != null}" th:object="${result}">
                <div  class="media" th:each="item : *{list}">
                    <div class="media-left">
                        <a th:href="@{/question/{id}(id=${item.id})}">
                            <img class="img_size media-object" src="http://qseoqy0p2.hn-bkt.clouddn.com/zhugeliang.jpg"
                                 alt="...">
                        </a>
                    </div>
                    <div class="media-body">
                        <h4 style="font-weight: 600;margin-top: 5px;line-height: 40px" class="media-heading" ><a th:href="@{/question/{id}(id=${item.id})}" th:text="${item.title}"></a></h4>
                        <div>
                            <div class="text_desc"><span th:text="${item.commentCount}"></span>个回复 • <span
                                    th:text="${item.viewCount}"></span>次浏览 • <span
                                    th:text="${#dates.format(item.getGmtCreate(), 'yyyy-MM-dd HH:mm:ss')}"></span>
                            </div>
                        </div>
                    </div>

                </div>
                <div class="fr">
                    <ul class="pagination  pagination-lg">
                        <li th:unless="*{isFirstPage}">
                            <a th:href="@{/profile/questions(currentPage=*{pageNum - 1},pageSize=5)}" aria-label="Previous">
                                <span aria-hidden="true">&laquo;</span>
                            </a>
                        </li>
                        <li th:each="index: ${#numbers.sequence(firstIndex, lastIndex)}"
                            th:classappend="${index == result.pageNum} ? 'active'"><a
                                th:href="@{/profile/questions(currentPage=${index},pageSize=5)}" th:text="${index}"></a></li>
                        <li th:unless="*{isLastPage}">
                            <a th:href="@{/profile/questions(currentPage=*{pageNum + 1},pageSize=5)}" aria-label="Next">
                                <span aria-hidden="true">&raquo;</span>
                            </a>
                        </li>
                    </ul>
                </div>
            </div>
            <div th:if="${section == 'replies'}" th:object="${nofifyInfo}">
                    <ul class="notification">
                        <li th:each="notify : *{list}">
                            <span th:text="${notify.notifiedUser.name}"></span>&nbsp;
                            <span th:if="${notify.type == 1}">回复了问题</span>
                            <span th:if="${notify.type == 2}">回复了评论</span>
                            &nbsp;<a th:if="${notify.comment == null}" th:href="@{/notification(questionId = ${notify.question.id},notificationId = ${notify.id})}">
                                <span th:text="${notify.question.title}"></span>
                            </a>
                            <a th:if="${notify.comment != null}" th:href="@{/notification(questionId = ${notify.question.id},notificationId = ${notify.id})}">
                                <span th:text="${notify.comment.content}"></span>
                            </a>
                            <span th:if="${notify.status == 0}"><span class="label label-danger">未读</span></span>
                            <div style="font-size: 12px;color: #999;line-height: 15px"  th:text="${#dates.format(notify.gmtCreate, 'yyyy-MM-dd HH:mm;ss ')}"></div>
                            <hr>
                        </li>

                    </ul>
                    <div th:if="*{list.size() != 0}" class="fr">
                        <ul class="pagination  pagination-lg">
                            <li th:unless="*{isFirstPage}">
                                <a th:href="@{/profile/replies(currentPage=*{pageNum - 1},pageSize=5)}" aria-label="Previous">
                                    <span aria-hidden="true">&laquo;</span>
                                </a>
                            </li>
                            <li th:each="index: ${#numbers.sequence(firstIndex, lastIndex)}"
                                th:classappend="${index == nofifyInfo.pageNum} ? 'active'"><a
                                    th:href="@{/profile/replies(currentPage=${index},pageSize=5)}" th:text="${index}"></a></li>
                            <li th:unless="*{isLastPage}">
                                <a th:href="@{/profile/replies(currentPage=*{pageNum + 1},pageSize=5)}" aria-label="Next">
                                    <span aria-hidden="true">&raquo;</span>
                                </a>
                            </li>

                        </ul>
                    </div>
            </div>
        </div>
        <div class="col-lg-3 col-md-12 col-sm-12 col-xs-12">
            <div class="list-group profile_nav">
                <a th:href="@{/profile/questions}" class="list-group-item " th:classappend="${section == 'questions'} ? 'active'">
                    我的问题
                </a>
                <a th:href="@{/profile/replies}" class="list-group-item" th:classappend="${section == 'replies'} ? 'active'">
                    <span class="badge" ><span th:text="${count}"></span></span>我的回复
                </a>
            </div>
        </div>
    </div>
</div>
<script src="/jquery/jquery.js"></script>
<script src="/bootstrap/js/bootstrap.min.js"></script>
</body>
</html>